//
//  SetPasswordController.m
//  shike
//
//  Created by RegentSoft on 2017/4/20.
//  Copyright © 2017年 RegentSoft. All rights reserved.
//

#import "SetPasswordController.h"

@interface SetPasswordController ()

@end

@implementation SetPasswordController

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self.navigationController setNavigationBarHidden:NO animated:YES];
    self.view.backgroundColor = [UIColor colorWithHexString:@"#F0F0F5"];
    UINavigationBar * navgabar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, DeviceWidth, 64)];
    navgabar.userInteractionEnabled = YES;
    navgabar.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:navgabar];
    UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((DeviceWidth-70)/2, 30, 70, 20)];
    titleLabel.textColor = [UIColor colorWithHexString:@"#323232"];
    titleLabel.font = [UIFont systemFontOfSize:16.0];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"修改密码";
    [navgabar addSubview:titleLabel];
    
    UIButton * backButton = [[UIButton alloc]initWithFrame:CGRectMake(8, 30, 20, 20)];
    backButton.backgroundColor = [UIColor clearColor];
    [backButton setImage:[UIImage imageNamed:@"backbtn"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(returnButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [navgabar addSubview:backButton];
    
    UIView * view = [[UIView alloc] init];
    view.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
    view.layer.cornerRadius = 4.0;
    [self.view addSubview:view];
    UITextField * passwText = [[UITextField alloc] init];
    passwText.textAlignment = NSTextAlignmentLeft;
    passwText.font = [UIFont systemFontOfSize:14.0];
    passwText.textColor = [UIColor colorWithHexString:@"#999999"];
    passwText.placeholder = @"新密码";
    [view addSubview:passwText];
    
    UITextField * newPasswText = [[UITextField alloc] init];
    newPasswText.textAlignment = NSTextAlignmentLeft;
    newPasswText.font = [UIFont systemFontOfSize:14.0];
    newPasswText.textColor = [UIColor colorWithHexString:@"#999999"];
    newPasswText.placeholder = @"确认密码";
    [view addSubview:newPasswText];
    
    UIView * lineView =[[UIView alloc] init];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#C8C8C8"];
    [view addSubview:lineView];
    
    UIButton * trueButton = [[UIButton alloc] init];
    [trueButton setTitle:@"确定" forState:UIControlStateNormal];
    trueButton.backgroundColor = [UIColor colorWithHexString:@"#61CAFD"];
    trueButton.layer.cornerRadius = 8.0;
    [trueButton addTarget:self action:@selector(trueBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:trueButton];
    
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(0);
        make.right.equalTo(self.view.mas_right).offset(0);
        make.top.equalTo(self.view.mas_top).offset(64);
        make.height.mas_equalTo(101);
    }];
    [passwText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(15);
        make.right.equalTo(self.view.mas_right).offset(0);
        make.top.equalTo(view.mas_top).offset(0);
        make.height.mas_equalTo(50);
    }];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(0);
        make.right.equalTo(self.view.mas_right).offset(0);
        make.top.equalTo(passwText.mas_bottom).offset(0);
        make.height.mas_equalTo(1);
    }];
    [newPasswText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(15);
        make.right.equalTo(self.view.mas_right).offset(0);
        make.top.equalTo(lineView.mas_bottom).offset(0);
        make.height.mas_equalTo(50);
    }];
    [trueButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(20);
        make.right.equalTo(self.view.mas_right).offset(-20);
        make.top.equalTo(view.mas_bottom).offset(20);
        make.height.mas_equalTo(40);
    }];

}
-(void)returnButtonClick{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)trueBtnClick{
    [(AppDelegate*)[UIApplication sharedApplication].delegate setRootVC];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
